package com.yzh.omework.homework01;

/**
 * @author 于振晗
 * @title: Dog
 * @description: TODO 狗类
 * @date 2020年08月25日
 * @path com.yzh.HomeWork.homework01
 */
public class Dog {
    private String variety;//品种
    private int age;//年龄
    private String mood;//心情
    private String name;//名字

    public Dog() {
    }

    public Dog(String variety, int age, String mood, String name) {
        this.variety = variety;
        this.age = age;
        this.setMood(mood);
        this.name = name;
    }

    public String getVariety() {
        return variety;
    }

    public void setVariety(String variety) {
        this.variety = variety;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getMood() {
        return mood;
    }

    public void setMood(String mood) {
        if(mood.equals("心情不好")){
            this.mood = mood;
        }else if(mood.equals("心情好")){
            this.mood = mood;
        }else{
            System.out.println("心情输入错误");
            this.mood = "心情好";
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void call(){
        if(this.mood.equals("心情好")){
            System.out.println("名字叫"+this.name+"的"+this.variety+"心情很好，开心的汪汪叫");
        }else{
            System.out.println("名字叫"+this.name+"的"+this.variety+"心情不好，伤心的呜呜叫");
        }
    }

    public void run(){
        if(this.mood.equals("心情好")){
            System.out.println("名字叫"+this.name+"的"+this.variety+"心情很好，开心的围着主人身边转");
        }else{
            System.out.println("名字叫"+this.name+"的"+this.variety+"心情不好，伤心的一动不动");
        }
    }

}

class Test{
    public static void main(String[] args) {
        Dog dog = new Dog("贵宾犬", 20,"心情dd好", "甜心");
        dog.run();
        dog.call();
        System.out.println("=====================");
        Dog dog2 = new Dog("德国牧羊犬", 20,"心情不好", "太子");
        dog2.run();
        dog2.call();
    }
}